package com.clwl.supervise.superviseapp.mapper.base;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clwl.supervise.superviseapp.beans.certificaReview.CertificaReviewSearchParams;
import com.clwl.supervise.superviseapp.beans.company.CompanySearchParams;
import com.clwl.supervise.superviseapp.beans.company.SimpleCompany;
import com.clwl.supervise.superviseapp.entity.base.CommonSearchEntity;
import com.clwl.supervise.superviseapp.entity.base.ProcessBathQueryEntity;
import com.clwl.supervise.superviseapp.entity.base.TcCompany;
import com.clwl.supervise.superviseapp.entity.pro.JgTcCompany;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface TcCompanyMapper extends BaseMapper<TcCompany> {

    /**
     * 获取日常检查的企业列表
     * @param userId 当前登陆人id
     * @return
     */
    Page<Map<String, Object>> selectDailyInpectionPage(Page<Map<String, Object>> iPage,/*@Param("startNum")Integer startNum, @Param("endNum")Integer endNum,*/ @Param("params") CommonSearchEntity commonSearchEntity,
                                                       @Param("processBathQueryEntityList")  List<ProcessBathQueryEntity> processBathQueryEntityList ,  @Param("codeList")  List<String> codeList ,@Param("currentYear") int currentYear
    );

    Long selectDailyInpectionCount(@Param("params") CommonSearchEntity commonSearchEntity,
                                   @Param("processBathQueryEntityList")  List<ProcessBathQueryEntity> processBathQueryEntityList ,  @Param("codeList")  List<String> codeList ,@Param("currentYear") int currentYear);

    /**
     * 获取已检查历史列表
     * @param iPage
     * @param userId
     * @return
     */
    Page<Map<String, Object>> selectInspectionResultPage(IPage<Map<String, Object>> iPage, @Param("params") CommonSearchEntity commonSearchEntity );

    Long selectInspectionResultCount(@Param("params") CommonSearchEntity commonSearchEntity);
    /**
     * 获取检查的基础信息中的监管单位信息
     * @param companyId 企业id
     * @return
     */
    Map<String, Object> selectCompanyInspectionInfo(@Param("companyId") Long companyId);

    /**
     * 获取企业的业态信息
     * @param companyId
     * @return
     */
    Map<String, Object> selectBusinessFormatById(@Param("companyId")  Object companyId);

    /**
     * 路线规划查询企业
     * @param list
     * @return
     */
    List<Map<String, Object>> getRoutePlanList(@Param("list") List<String> list,@Param("type") String type,@Param("checktype") String checktype);

    Page<JgTcCompany> selectProList(IPage<Map<String, Object>> iPage, @Param("params") CommonSearchEntity params);

    Page<JgTcCompany> selectCompleteProList(Page<Map<String, Object>> iPage, @Param("params") CommonSearchEntity commonSearchEntity);

    IPage<SimpleCompany> selectCompanyList(IPage<Map<String, Object>> iPage, @Param("params") CompanySearchParams params);

    String getScbusinessCategory(@Param("companyId")Long companyId);

    /**
     * 查询智能任务中的列表信息 按照时限查询
     * @param iPage
     * @param deptId
     * @param sortOrder
     * @return
     */
    IPage<Map<String, Object>> selectIntelligentTaskTimeOrderList(IPage<Map<String, Object>> iPage, @Param("deptId") Long deptId, @Param("sortOrder") Integer sortOrder);
    /**
     * 查询智能任务中的列表信息 按照风险高低排序
     * @param iPage
     * @param deptId
     * @param sortOrder
     * @return
     */
    IPage<Map<String, Object>> selectIntelligentTaskRiskList(IPage<Map<String, Object>> iPage,@Param("deptId") Long deptId, @Param("sortOrder") Integer sortOrder);

    /**
     * 查询智能任务中的列表信息 按照发现问题数
     * @param iPage
     * @param deptId
     * @param sortOrder
     * @return
     */
    IPage<Map<String, Object>> selectIntelligentTaskProblemCountList(IPage<Map<String, Object>> iPage, @Param("deptId") Long deptId, @Param("sortOrder") Integer sortOrder);

    List<TcCompany> selectEntityList(IPage<Map<String, Object>> iPage);


    Map<String, Object> selectByCredit(@Param("xkzbh") String xkzbh,@Param("yyzzh") String yyzzh);

    /**
     * 获取企业列表通过企业类型
     */
    List<Map<String, Object>> selectCompanyByType( @Param("params") Map<String,Object> params);

    @Options(timeout = 50)
    Map<String, Object> selectDailyTaskCountStatistics(@Param("params") Map<String, Object> params);
    @Options(timeout = 30)
    Map<String, Object> selectDoubleTaskCountStatistics(@Param("params") Map<String, Object> params);
    @Options(timeout = 30)
    Map<String, Object> selectRectificationCountStatistics(@Param("params") Map<String, Object> params);

    /**
     * 体系检查
     * @param params
     * @return
     */
    @Options(timeout = 30)
    Map<String, Object> selectSystemTaskCountStatistics(@Param("params") CommonSearchEntity params);

    /**
     * 飞行检查
     * @param params
     * @return
     */
    @Options(timeout = 30)
    Map<String, Object> selectFlightTaskCountStatistics(@Param("params") CommonSearchEntity params);

    /**
     * 统计证后审查数据
     * @param params
     * @return
     */
    @Options(timeout = 30)
    Map<String, Object> selectSyndromeRevieCountStatistics(@Param("params") CertificaReviewSearchParams params);
    @Options(timeout = 30)
    Map<String, Object> selectScoreCountStatistics(@Param("params") Map<String, Object> params);
    @Options(timeout = 30)
    Map<String, Object> selectGradeCountStatistics(@Param("params") Map<String, Object> params);
    @Options(timeout = 30)
    Map<String, Object> selectPunishCountStatistics(@Param("params") Map<String, Object> params);
    @Options(timeout = 30)
    Map<String, Object> selectOverdueCountStatistics(@Param("params") Map<String, Object> params);

    TcCompany selectEntityById(@Param("id") long companyId);



}